package org.example.springboot.service;

import org.apache.ibatis.annotations.Param;
import org.example.springboot.dao.CustomersMapper;
import org.example.springboot.dao.ItemsMapper;
import org.example.springboot.model.Customers;
import org.example.springboot.model.Items;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class CustomersService {
    @Autowired
    private CustomersMapper customersMapper;

    public String insertCustomer(String enterpriseCode,String address, String bankName,String bankAccount,String invoiceNumber,String companyPhone, String description,String customerName, String contactPerson,String contactPhone,String customerType){
        customersMapper.insertCustomer(enterpriseCode,address,bankName,bankAccount,invoiceNumber,companyPhone,description,customerName,contactPerson,contactPhone,customerType);
        return "succeed";
    }

    public List<Customers> getAllCustomer(){
        return customersMapper.getAllCustomer();
    }

    public List<Customers> findCustomerByKeyword(String keyword){
        return customersMapper.findCustomerByKeyword(keyword);
    }

    public Customers findCustomerByCode(String enterpriseCode){
        return customersMapper.findCustomerByCode(enterpriseCode);
    }

    public void deleteCustomerByCode(String enterpriseCode){
        customersMapper.deleteCustomerByCode(enterpriseCode);
    }
}
